#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<unistd.h>
int main()
{
  umask(0);
  int fd=open("log.txt",O_RDONLY);
  if(fd<0)
  {
    perror("open");
    exit(1);
  }
  char*msg="hello world\n";
  char buff[1024];
  memset(buff,0,sizeof(buff));
  while(1)
  {
    ssize_t s=read(fd,buff,strlen(msg));
    if(s>0)
    {
      printf("%s",buff);
    }
    else 
    {
      break;
    }
  }
  close(fd);
  return 0;
}
